﻿using RockBus.DataContracts;
using System.ServiceModel;
using System.Threading.Tasks;

namespace RockBus.ConfigurationService.Interfaces
{
    [ServiceContract(Namespace = StringConstants.RockBusNamespace)]
    public interface IConfigurationServiceAsync
    {
        //[OperationContract(Action = StringConstants.AddOrUpdateAction, ReplyAction = StringConstants.RockBusAckAction)]
        //Task<RockBusAck> AddOrUpdateAsync(AddOrUpdatePublishersRequest publishersRequest, AddOrUpdateSubscribersRequest subscribersRequest);

        [OperationContract(Action = StringConstants.AddOrUpdateSubscribersAction, ReplyAction = StringConstants.RockBusAckAction)]
        Task<RockBusAck> AddOrUpdateSubscribersAsync(AddOrUpdateSubscribersRequest request);

        [OperationContract(Action = StringConstants.RemoveSubscribersAction, ReplyAction = StringConstants.RockBusAckAction)]
        Task<RockBusAck> RemoveSubscribersAsync(RemoveSubscribersRequest request);

        [OperationContract(Action = StringConstants.RemoveSubscriptionsAction, ReplyAction = StringConstants.RockBusAckAction)]
        Task<RockBusAck> RemoveSubscriptionsAsync(RemoveSubscriptionsRequest request);

        [OperationContract(Action = StringConstants.AddOrUpdatePublishersAction, ReplyAction = StringConstants.AddOrUpdatePublishersResponseAction)]
        Task<AddOrUpdatePublishersResponse> AddOrUpdatePublishersAsync(AddOrUpdatePublishersRequest request);

        [OperationContract(Action = StringConstants.RemovePublishersAction, ReplyAction = StringConstants.RockBusAckAction)]
        Task<RockBusAck> RemovePublishersAsync(RemovePublishersRequest request);

        [OperationContract(Action = StringConstants.RemoveReceivePortsAction, ReplyAction = StringConstants.RockBusAckAction)]
        Task<RockBusAck> RemoveReceivePortsAsync(RemoveReceivePortsRequest request);

        [OperationContract(Action = StringConstants.RemoveAllSubscribersAction, ReplyAction = StringConstants.RockBusAckAction)]
        Task<RockBusAck> RemoveAllSubscribersAsync(RemoveAllSubscribersRequest request);

        [OperationContract(Action = StringConstants.RemoveAllPublishersAction, ReplyAction = StringConstants.RockBusAckAction)]
        Task<RockBusAck> RemoveAllPublishersAsync(RemoveAllPublishersRequest request);

        [OperationContract(Action = StringConstants.GetInternalConfiguration, ReplyAction = StringConstants.RockBusAckAction)]
        Task<InternalConfiguration> GetInternalConfiguration();

        [OperationContract(Action = StringConstants.SetInternalConfiguration, ReplyAction = StringConstants.RockBusAckAction)]
        Task<RockBusAck> SetInternalConfiguration(InternalConfiguration configuration);
    }

    [ServiceContract(Namespace = StringConstants.RockBusNamespace)]
    public interface IConfigurationServiceOneWayAsync
    {
        //[OperationContract(IsOneWay = true, Action = StringConstants.AddOrUpdateAction)]
        //Task AddOrUpdateAsync(AddOrUpdatePublishersRequest publishersRequest, AddOrUpdateSubscribersRequest subscribersRequest);

        [OperationContract(IsOneWay = true, Action = StringConstants.AddOrUpdateSubscribersAction)]
        Task AddOrUpdateSubscribersAsync(AddOrUpdateSubscribersRequest request);

        [OperationContract(IsOneWay = true, Action = StringConstants.RemoveSubscribersAction)]
        Task RemoveSubscribersAsync(RemoveSubscribersRequest request);

        [OperationContract(IsOneWay = true, Action = StringConstants.RemoveSubscriptionsAction)]
        Task RemoveSubscriptionsAsync(RemoveSubscriptionsRequest request);

        [OperationContract(IsOneWay = true, Action = StringConstants.AddOrUpdatePublishersAction)]
        Task AddOrUpdatePublishersAsync(AddOrUpdatePublishersRequest request);

        [OperationContract(IsOneWay = true, Action = StringConstants.RemovePublishersAction)]
        Task RemovePublishersAsync(RemovePublishersRequest request);

        [OperationContract(IsOneWay = true, Action = StringConstants.RemoveReceivePortsAction)]
        Task RemoveReceivePortsAsync(RemoveReceivePortsRequest request);

        [OperationContract(IsOneWay = true, Action = StringConstants.RemoveAllSubscribersAction)]
        Task RemoveAllSubscribersAsync(RemoveAllSubscribersRequest request);

        [OperationContract(IsOneWay = true, Action = StringConstants.RemoveAllPublishersAction)]
        Task RemoveAllPublishersAsync(RemoveAllPublishersRequest request);

        [OperationContract(IsOneWay = true, Action = StringConstants.SetInternalConfiguration)]
        Task<RockBusAck> SetInternalConfiguration(InternalConfiguration configuration);
    }
}